import request from '@/plugins/axios'
// ----------------巡检 ---------------

export function getPatrolList(params) {
  return request({
    url: 'api/shuiwu/xjrwgl/list',
    method: 'get',
    params
  })
}

export function savePatrol(data) {
  return request({
    url: 'api/shuiwu/xjrwgl/save',
    method: 'post',
    data
  })
}

export function getPatrolDetail(id) {
  return request({
    url: `api/shuiwu/xjrwgl/${id}`,
    method: 'get'
  })
}

export function delPatrol(data) {
  return request({
    url: `api/shuiwu/xjrwgl`,
    method: 'delete',
    data
  })
}

// 启用/停用计划巡检任务
export function setPatrol(data) {
  return request({
    url: `api/shuiwu/xjrwgl/changeStatus`,
    method: 'post',
    data
  })
}

// 当前巡检
export function getCurrentPatrolList(params) {
  return request({
    url: 'api/shuiwu/xjrw/list',
    method: 'get',
    params
  })
}

export function delCurrentPatrol(data) {
  return request({
    url: 'api/shuiwu/xjrw',
    method: 'delete',
    data
  })
}

export function changePatrolStatus(data) {
  return request({
    url: 'api/shuiwu/xjrw/changeStatus',
    method: 'post',
    data
  })
}

export function getCurrentPatrolDetail(id) {
  return request({
    url: `api/shuiwu/xjrw/${id}`,
    method: 'get'
  })
}

// 历史巡检
export function getHistoryPatrolList(params) {
  return request({
    url: 'api/shuiwu/xjrw/history/list',
    method: 'get',
    params
  })
}

// 下载详情
export function downloadReport(id) {
  return request({
    url: `api/shuiwu/xjrw/export/${id}`,
    method: 'get',
    responseType: 'blob'
  })
}

// 获取巡检标准列表
export function getStepList(params) {
  return request({
    url: `api/shuiwu/criterion/list`,
    method: 'get',
    params
  })
}

// 保存巡检标准库
export function saveStep(data) {
  return request({
    url: `api/shuiwu/criterion/save`,
    method: 'post',
    data
  })
}

//根据ID获取标准库详情
export function getStepDetail(id) {
  return request({
    url: `api/shuiwu/criterion/${id}`,
    method: 'get'
  })
}

//根据ID获取标准库详情
export function delStep(data) {
  return request({
    url: `api/shuiwu/criterion`,
    method: 'delete',
    data
  })
}
